import axios from 'axios'
export default  {
    namespaced:true,
    state: {
        Books: []
    },
    mutations: {
        getBooks(state, newBooks) {
            state.Books = newBooks
        }
    },
    actions: {
        async AgetBooks(context) {
            const res = await axios({
                url: "https://www.fastmock.site/mock/37d3b9f13a48d528a9339fbed1b81bd5/book/api/books"
            })
            // console.log(res);
            context.commit('getBooks', res.data.data)
        }
    }
}